package com.qf.hello.mybatis.dao;

import com.qf.hello.mybatis.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {

    // 根据ID查询用户
    User selectUserById(Integer id);

    User selectUserByNameAndPwd(@Param("name") String name, @Param("password") String pwd);

    User selectUserByNameAndPwdWithMap(Map<String,String> map);

    User selectUserByNameAndPwdWithUser(User user);

    //模糊查询
    User selectUserByName(String name);

    //动态SQL-sql
    List<User> selectUserByName2(String name);

    //动态查询 根据name或者passport查询用户
    List<User> selectUserByNameOrPassword(@Param("name") String name, @Param("password") String password);

    List<User> selectAll();

    //删除
    int deleteUser(int id);
    //修改
    int updateUser(User user);
    //添加
    int insertUser(User user);
    //主键回填
    int insert(User user);
}
